package com.weixin.paleituo.activity;

import android.content.Context;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.adapter.WuyePaymentPagerAdapter;
import com.weixin.paleituo.base.BaseActivity;
import com.weixin.paleituo.view.ForbidScrollViewpager;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 物业缴费
 */
public class WuyePaymentActivity extends BaseActivity {

    @BindView(R.id.iv_back_activity_basepersoninfo)
    ImageView mIvBackActivityBasepersoninfo;
    @BindView(R.id.tv_title_activity_baseperson)
    TextView mTvTitleActivityBaseperson;
    @BindView(R.id.tv_small_title_layout_head)
    TextView mTvSmallTitleLayoutHead;
    @BindView(R.id.rl_head_root_activity_baseperson)
    RelativeLayout mRlHeadRootActivityBaseperson;
    @BindView(R.id.iv_location_activity_wuye_payment)
    ImageView mIvLocationActivityWuyePayment;
    @BindView(R.id.tv_xiaoqu_name_activity_wuye_payment)
    TextView mTvXiaoquNameActivityWuyePayment;
    @BindView(R.id.tv_housenumber_activity_wuye_payment)
    TextView mTvHousenumberActivityWuyePayment;
    @BindView(R.id.iv_more_actvity_wuye_payment)
    ImageView mIvMoreActvityWuyePayment;
    @BindView(R.id.rl_houseroot_activity_wuye_payment)
    RelativeLayout mRlHouserootActivityWuyePayment;
    @BindView(R.id.tl_tab_activity_wuye_payment)
    TabLayout mTlTabActivityWuyePayment;
    @BindView(R.id.forbidscroll_viewpager_activity_wuye_payment)
    ForbidScrollViewpager mForbidscrollViewpagerActivityWuyePayment;

String[] titles={"待缴账单","历史账单"};


    @Override
    protected void initView() {

        setContentView(R.layout.activity_wuye_payment);
    }

    @Override
    protected void initData() {
        super.initData();
        mTvTitleActivityBaseperson.setText("物业缴费");

        WuyePaymentPagerAdapter wuyePaymentPagerAdapter=new WuyePaymentPagerAdapter(getSupportFragmentManager(),titles);


        mForbidscrollViewpagerActivityWuyePayment.setAdapter(wuyePaymentPagerAdapter);
        mTlTabActivityWuyePayment.setupWithViewPager(mForbidscrollViewpagerActivityWuyePayment);

        mTlTabActivityWuyePayment.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                //切换ViewPager
                mForbidscrollViewpagerActivityWuyePayment.setCurrentItem(tab.getPosition(),false);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }
            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
    }

    @OnClick(R.id.iv_back_activity_basepersoninfo)
    public void onMIvBackActivityBasepersoninfoClicked() {
        finish();
    }

    @OnClick(R.id.rl_houseroot_activity_wuye_payment)
    public void onMRlHouserootActivityWuyePaymentClicked() {

     SelectHouseActivity.myStartActvity(this);
    }
    public static void myStartActivity(Context context){
        Intent intent=new Intent(context,WuyePaymentActivity.class);
        context.startActivity(intent);
    }
}
